//
//  VMCNavigationBar.m
//  vmcshop
//
//  Created by toggle on 15/6/4.
//  Copyright (c) 2015年 idongler. All rights reserved.
//

#import "VMCNavigationBar.h"

@implementation VMCNavigationBar

- (id)initWithFrame:(CGRect)frame
{
	self = [super initWithFrame:frame];
	if (self)
	{
		self.backgroundColor = RGB(17, 130, 36);
		_titleLabel = [[UILabel alloc] init];
		_titleLabel.backgroundColor = [UIColor clearColor];
		_titleLabel.numberOfLines = 1;
		_titleLabel.textColor = [UIColor whiteColor];
		_titleLabel.textAlignment = NSTextAlignmentCenter;
		_titleLabel.font = [UIFont boldSystemFontOfSize:18];
		[self addSubview:_titleLabel];
		
		_line = [[UILabel alloc] init];
		_line.backgroundColor = [UIColor colorWithRed:220/255.0f green:220/255.0f blue:225/255.0f alpha:1.0f];
		[self addSubview:_line];
	}
	return self;
}

- (void)layoutSubviews
{
	[super layoutSubviews];
	
	CGRect fm = self.bounds;
	fm.size.width *= 0.6f;
	fm.size.height = 44.0f;
	_titleLabel.frame = fm;
	_titleLabel.center = CGPointMake(self.bounds.size.width / 2.0f, self.bounds.size.height - _titleLabel.bounds.size.height / 2.0f);
	_line.frame = CGRectMake(0, CGRectGetHeight(self.frame)-0.5, CGRectGetWidth(self.frame), 0.5);
}

@end
